<template>
  <el-space :size="20" wrap alignment="top">
    <el-card>
      <el-button>Default</el-button>
      <el-button type="primary">Primary</el-button>
      <el-button type="success">Success</el-button>
      <el-button type="info">Info</el-button>
      <el-button type="warning">Warning</el-button>
      <el-button type="danger">Danger</el-button>
    </el-card>
    <el-card>
      <el-button type="primary" :icon="Edit" />
      <el-button type="primary" :icon="Share" />
      <el-button type="primary" :icon="Delete" />
      <el-button type="primary" :icon="Search">Search</el-button>
      <el-button type="primary">
        Upload<el-icon class="el-icon--right"><Upload /></el-icon>
      </el-button>
    </el-card>
    <el-card>
      <p style="color: var(--el-color-primary)">统一使用elementplus的主题</p>
      <p style="color: var(--el-color-success)">统一使用elementplus的主题</p>
      <p style="color: var(--el-color-warning)">统一使用elementplus的主题</p>
      <p style="color: var(--el-color-danger)">统一使用elementplus的主题</p>
      <p style="color: var(--el-color-error)">统一使用elementplus的主题</p>
      <p style="color: var(--el-color-info)">统一使用elementplus的主题</p>
    </el-card>
    <el-card>
      <el-input type="text" v-model="testStore.count" />
      <el-button type="primary" @click="() => testStore.count++"> {{ testStore.count }}</el-button>
      <el-button @click="toggleDarkMode">切换暗色模式</el-button>
    </el-card>
    <el-card style="width: 100vw">
      <el-space :size="20" warp direction="vertical" alignment="top" style="width: 100%">
        <el-space :size="20">
          <el-input></el-input>
          <el-button type="primary">Primary</el-button>
          <el-button type="success">Success</el-button>
          <el-button type="info">Info</el-button>
          <el-button type="warning">Warning</el-button>
          <el-button type="danger">Danger</el-button>
        </el-space>
        <NTable></NTable>
        <NPagination style="display: flex; justify-content: flex-end"></NPagination>
      </el-space>
    </el-card>
  </el-space>
</template>

<script lang="ts" setup>
// 测试 element-plus 组件和 element-plus-icon
import { Delete, Edit, Search, Share, Upload } from '@element-plus/icons-vue'
import { test } from '@/api/test'
import { onMounted } from 'vue'

// 测试 pinia
import useTestStore from '@/store/test'
const testStore = useTestStore()
console.log(testStore.count)

// 测试 axios
onMounted(async () => {
  await test()
  console.log('出错吧，程序')
})

// 暗黑主题
function toggleDarkMode() {
  document.documentElement.classList.toggle('dark')
}

import NTable from './components/NTable.vue'
import NPagination from './components/NPagination.vue'
</script>

<style lang="scss" scoped></style>
